<script setup lang="ts">

</script>

<template>

<div class="wrap">
  <header>
    <h1>W3cplus</h1>
    <nav>
      <ul>
        <li>
          <a href="">home</a>
        </li>
        <li>
          <a href="">blog</a>
        </li>
        <li>
          <a href="">about</a>
        </li>
        <li>
          <a href="">contact</a>
        </li>
      </ul>
    </nav>
  </header>
  <main>
    <article>
      <h2>现代 web 布局技术</h2>
      <p>使用 CSS Flexbox 技术构建圣杯布局（Holy Grail Layout）。圣杯布局是一种经典的 Web 布局技术!其主要特征，一个三列布局，且内容先行！</p>
    </article>
    <aside>
      <h3>左侧边栏</h3>
    </aside>
    <aside>
      <h3>右侧边栏</h3>
    </aside>
  </main>
  <footer>
    <ul>
      <li>
        <a href="">home</a>
      </li>
      <li>
        <a href="">blog</a>
      </li>
      <li>
        <a href="">about</a>
      </li>
      <li>
        <a href="">contact</a>
      </li>
    </ul>
  </footer>
</div>
</template>

<style scoped lang="scss">
.wrap  {
  width: 100vw;
  min-height: 100vh;
  font-family:  "Exo", Arial, sans-serif;
  background-color: #f90;
  color: #fff;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1px;


  header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    background-color: #fff;
    color: #f90;
    padding: 1vw 20px;
    font-size: 0.8rem;

    ul {
      list-style: none outside none;
      display: flex;
      gap: 18px;
      align-items: center;
      a {
        display: block;
        padding: 0.35em 0.5em;
        text-transform: uppercase;
        white-space: nowrap;
        color: #f90;
        text-decoration: none;
      }
    }
  }

  main {
    flex: 1 1 0%; // flex-basic 0% 的时候收缩因子不生效
    min-height: 0;
    display: flex;
    gap: 1px;

    article {
      background-color: #fff;
      flex: 1 1 0%;
      min-width: 0;
    }

    aside {
      background-color: #fff;
      min-width: 220px;
      max-width: 320px;
      &:nth-of-type(1) { // CSS 伪类基于相同类型（标签名称）的兄弟元素中的位置来匹配元素。
        order: -1;
      }
    }
  }
  @media screen and (max-width: 800px) {
    main {
      flex-direction: column;

      aside {
        width: 100%;
        max-width: none !important;

        &:nth-of-type(1) {
          order: 1;
        }
      }
    }
  }

  footer {
    background-color: #fff;
    color: #f90;
    padding: 1vw 20px;
    font-size: 0.8rem;

    ul {
      list-style: none outside none;
      display: flex;
      gap: 18px;
      align-items: center;
      a {
        display: block;
        padding: 0.35em 0.5em;
        text-transform: uppercase;
        white-space: nowrap;
        color: #f90;
        text-decoration: none;
      }
    }
  }
}

</style>
